home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / vla / viewtga / viewtga.doc < prev    next >
Text File  |  1994-01-14  |  3KB  |  91 lines

  1.  
  2.  
  3.                                 VIEWTGA by VLA
  4.  
  5. ═════════════════───────────────              ──────────────══════════════════
  6.  
  7.     Well, it's your ol'buddy Lithium here with another in our series of 
  8. Assembly Language programs for you beginners.  This is a simple littel file
  9. that will load up a 320x200 TGA file and dump it on the VGA segment.  And
  10. Abra-Kadabra, Presto-Chango you got yourself a niffty picture on the screen.
  11.  
  12. Files In This Zip
  13. ─────────────────
  14.  
  15. VIEWTGA.ASM
  16. VIEWTGA.EXE
  17. VIEWTGA.DOC
  18. CLSUB.ASM
  19. MAKE.BAT
  20. VLAGOLD.TGA
  21. VLA.NFO
  22.  
  23.  
  24.     So you ask, how is this incredible feat prformed?  First the TGA format.
  25.  
  26. TGA Format
  27.  
  28. Byte
  29.  
  30. 0 - 17  
  31.  
  32.         18 byte Header
  33.  
  34. 12      dw  X size of the picture
  35. 14      dw  Y size of the picture
  36.  
  37.         I don't know what the rest of the header is, but basicly identifies
  38.         it as a TGA file
  39.  
  40. Byte
  41.  
  42. 18  -786    
  43.         
  44.         768 byte Palette
  45.  
  46.         It's in BGR format (Blue, Green, Red) Flipped from the way you
  47.         need it to display on the screen.  Each intensity is multipled
  48.         by 4.  So you want to each byte by 4 before putting it on the
  49.         VGA palette
  50.  
  51. Byte
  52.  
  53. 786 - (X*Y+786) 
  54.  
  55.         The Picture
  56.  
  57.         Starting right after the palette, it's just a straight dump of the
  58.         screen.  Each byte holds a value 0-255 that refers to a color in
  59.         the palette, say color number 100 is RGB (255,0,255) Purple, that's
  60.         what that pixel is.
  61.  
  62.  
  63.     So this is the way the program works.  First it gets the filename off
  64. the command line, using the CLSUB.ASM file, procedure GetCommandLine.
  65. We use that filename to load the file.  If none were given, we exit and tell
  66. the user of the error.  So, then we load the header, and get the size of the
  67. picture (This viewer will only display 320x200 pictures)  With that done, we
  68. load the palette.  Remember, it's reversed, so we'll have to fix that later.
  69. Then we load the rest of the file directly onto the VGA Segment.  This is why
  70. it only works with 320x200, since we are displaying in 320x200 mode.  Then
  71. we flip the palette and divide each byte by 4, write it to the VGA palette
  72. and then wait for a key press.  Then we exit.
  73.  
  74.  
  75.     This program uses TASM's IDEAL mode, you will need Borland's Turbo 
  76. Assemble and Linker to compile this program.
  77.  
  78. ──────────────
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88. üéâäåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½
  89. ¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒
  90. ╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ 
  91.